package top.songxs.yygh.hosp.cmn.readlistener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import top.songxs.yygh.model.cmn.Dict;
import top.songxs.yygh.hosp.cmn.mapper.DictMapper;
import top.songxs.yygh.vo.cmn.DictEeVo;

@Component
public class DictReadListener extends AnalysisEventListener<DictEeVo> {

    @Autowired
    DictMapper dictMapper;
    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
//        System.out.println(dictEeVo);
        Dict dict = new Dict();
        BeanUtils.copyProperties(dictEeVo,dict);
/*        dict.setCreateTime(new Date());
        dict.setUpdateTime(new Date());
        dict.setIsDeleted(0);*/
        //三行有默认值
        dictMapper.insert(dict);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("逐行读取完成");
    }














}
